/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Server.BUS;
import java.lang.*;
/**
 *
 * @author Trung
 */
public class StringUlti {
    //Xoa cac khoang trang thua va chuyen chuoi thanh chuoi IN HOA
    public static String formatString(String s)
    {
        String result = s;
        result = result.trim();
        int n = result.length();
        result = result.replaceAll("\n", "");
        result = result.replaceAll("\\s+", " ");//Xoa cac khoang trong thua o giua chuoi
        //result = result.toUpperCase();
        
        return result;
    }    
    
    public static String formatStringUpperCase(String s)
    {
        String result = s;
        result = result.trim();
        int n = result.length();
        result = result.replaceAll("\\s+", " ");//Xoa cac khoang trong thua o giua chuoi
        result = result.toUpperCase();
        
        return result;
    } 
    
    public static String[] formatArray(String[] array)
    {
        int n = array.length;
        for(int i = 0; i < n; i++)
        {
            array[i] = StringUlti.formatString(array[i]);
        }
        
        return array;
    }
}
